package mytool;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;   

public class Contact_us {
    
    private String CustomerName;
    private String CustomerMail;
    private String CustomerPhone;
    private String CustomerContent;
    Sender mail;
    
    public String execute() throws Exception { 
        HttpServletRequest request=ServletActionContext.getRequest();
        setCustomerName(request.getParameter("CustomerName").toString());
        setCustomerMail( request.getParameter("CustomerEmail").toString());
        setCustomerPhone(request.getParameter("CustomerPhone").toString());
        setCustomerContent(request.getParameter("CustomerContent").toString());
        String Content = "<table border='1'cellspacing='5' cellpadding='5'><tr><td>顧客姓名："
                                   +getCustomerName()+"</td></tr><tr><td>顧客信箱："
                                   +getCustomerMail()+"</td></tr><tr><td>顧客電話："
                                   +getCustomerPhone()+"</td></tr><tr><td>內容："
                                   +getCustomerContent()+"</td></tr></table>";
        mail=new Sender("pingchenko@gmail.com","CustomerQuestion",Content);
        return "success";
    }

    /**
     * @return the CustomerName
     */
    public String getCustomerName() {
        return CustomerName;
    }

    /**
     * @param CustomerName the CustomerName to set
     */
    public void setCustomerName(String CustomerName) {
        this.CustomerName = CustomerName;
    }

    /**
     * @return the CustomerMail
     */
    public String getCustomerMail() {
        return CustomerMail;
    }

    /**
     * @param CustomerMail the CustomerMail to set
     */
    public void setCustomerMail(String CustomerMail) {
        this.CustomerMail = CustomerMail;
    }

    /**
     * @return the CustomerPhone
     */
    public String getCustomerPhone() {
        return CustomerPhone;
    }

    /**
     * @param CustomerPhone the CustomerPhone to set
     */
    public void setCustomerPhone(String CustomerPhone) {
        this.CustomerPhone = CustomerPhone;
    }

    /**
     * @return the CustomerContent
     */
    public String getCustomerContent() {
        return CustomerContent;
    }

    /**
     * @param CustomerContent the CustomerContent to set
     */
    public void setCustomerContent(String CustomerContent) {
        this.CustomerContent = CustomerContent;
    }
}
